package com.theta.gateway.biz.shared.init;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import com.theta.gateway.biz.service.RouteCfgService;

import lombok.extern.slf4j.Slf4j;


/**
 * 网关路由初始化
 * @author theta
 *
 */
@Slf4j
@Component
public class GatewayRouteInitCommandLine implements CommandLineRunner{

	@Autowired
	private RouteCfgService routeCfgService;
	
	@Override
	public void run(String... args) throws Exception {
		log.info("start init GatewayRouteInitCommandLine.....");
		this.routeCfgService.refreshAllRoutes();
		log.info("finish init GatewayRouteInitCommandLine.....");
	}

}
